OpenStack Mitaka : How to use Ceilometer
2016/06/08 |
How to use the OpenStack Metering Service (Ceilometer).
his example is based on the environment like follows.
| +------------------+ | +------------------------+ | [ Control Node ] | | | [ Network Node ] | | Keystone |10.0.0.30 | 10.0.0.50| DHCP,L3,L2 Agent | | Glance |------------+------------| Metadata Agent | | Nova API |eth0 | eth0| Ceilometer Services | | Neutron Server | | | | +------------------+ | +------------------------+ eth0|10.0.0.51 +--------------------+ | [ Compute Node ] | | Nova Compute | | L2 Agent | | Ceilometer-Compute | +--------------------+ |
[1] | If you configured Ceilometer#1, Ceilometer#2, Ceilometer#3, the command below shows some results without errors like follows. |
root@dlp ~(keystone)# ceilometer meter-list +-------------------+------------+----------+------------------------+---------------------+-------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +-------------------+------------+----------+------------------------+---------------------+-------------------+ | cpu | cumulative | ns | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | instance | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance:m1.small | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | +-------------------+------------+----------+------------------------+---------------------+-------------------+ |
[2] | It's possible to monitor Compute Service (Nova) now. Try to create and start an instance, and next, input the command meter-list again, then meters are loged like follows. |
root@dlp ~(keystone)# nova list +--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+ | 545457b2-517f-4a3b-bae2-bb99beb8342a | Ubuntu_1604 | SHUTOFF | - | Shutdown | int_net=192.168.100.3, 10.0.0.201 | +--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+root@dlp ~(keystone)# nova start Ubuntu_1604 root@dlp ~(keystone)# ceilometer meter-list +---------------------+------------+----------+------------------------+---------------------+-------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+------------+----------+------------------------+---------------------+-------------------+ | cpu | cumulative | ns | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | disk.ephemeral.size | gauge | GB | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | disk.ephemeral.size | gauge | GB | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | disk.root.size | gauge | GB | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | disk.root.size | gauge | GB | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | instance | gauge | instance | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance:m1.small | gauge | instance | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance:m1.small | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | memory | gauge | MB | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | memory | gauge | MB | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | port | gauge | port | 188e5409-c6f4-4a7a-... | f13070920e5c477e... | 4e84300cbeeb4a... | | port.create | delta | port | 188e5409-c6f4-4a7a-... | f13070920e5c477e... | 4e84300cbeeb4a... | | vcpus | gauge | vcpu | 0fbc0272-285a-4d97-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | vcpus | gauge | vcpu | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | +---------------------+------------+----------+------------------------+---------------------+-------------------+ |
[3] | Configure to enable monitoring Image Service (Glance). |
root@dlp ~(keystone)#
vi /etc/glance/glance-api.conf # add into [DEFAULT] section
rpc_backend = rabbit
# add to the end [oslo_messaging_notifications] driver = messagingv2 [oslo_messaging_rabbit] rabbit_host = 10.0.0.30 rabbit_port = 5672 rabbit_userid = openstack rabbit_password = password
root@dlp ~(keystone)#
vi /etc/glance/glance-registry.conf # add into [DEFAULT] section
rpc_backend = rabbit
# add to the end [oslo_messaging_notifications] driver = messagingv2 [oslo_messaging_rabbit] rabbit_host = 10.0.0.30 rabbit_port = 5672 rabbit_userid = openstack rabbit_password = password
root@dlp ~(keystone)# systemctl restart glance-api glance-registry
# verify the configuration root@dlp ~(keystone)# ceilometer meter-list +-------------------+------------+----------+------------------------+---------------------+-------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +-------------------+------------+----------+------------------------+---------------------+-------------------+ | cpu | cumulative | ns | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | cpu_util | gauge | % | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | instance | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance:m1.small | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | +-------------------+------------+----------+------------------------+---------------------+-------------------+ # try to add a new image root@dlp ~(keystone)# glance image-create --name "Ubuntu1604_1" --file /var/kvm/images/ubuntu1604.img --disk-format qcow2 --container-format bare --visibility public root@dlp ~(keystone)# ceilometer meter-list +-------------------+------------+----------+------------------------+---------------------+-------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +-------------------+------------+----------+------------------------+---------------------+-------------------+ | cpu | cumulative | ns | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | cpu_util | gauge | % | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | image | gauge | image | 95b05349-e9cb-4e88-... | None ... | 98ea1b896d3a48... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None ... | 98ea1b896d3a48... | | image.size | gauge | B | 95b05349-e9cb-4e88-... | None ... | 98ea1b896d3a48... | | image.update | delta | image | 95b05349-e9cb-4e88-... | None ... | 98ea1b896d3a48... | | image.upload | delta | image | 95b05349-e9cb-4e88-... | None ... | 98ea1b896d3a48... | | instance | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | | instance:m1.small | gauge | instance | 2c7a1025-30d6-446a-... | 704a7f5cf84a4797... | 98ea1b896d3a48... | +-------------------+------------+----------+------------------------+---------------------+-------------------+ # meters are loged for Image Service |
[4] | Configure to enable monitoring Block Storage (Cinder). |
# change settings on Control Node, Network Node like follows root@dlp ~(keystone)# vi /etc/cinder/cinder.conf # add to the end [oslo_messaging_notifications] driver = messagingv2 # Control Node root@dlp ~(keystone)# systemctl restart cinder-api cinder-scheduler # Network Node root@network:~# systemctl restart cinder-volume
# verify the configuration root@dlp ~(keystone)# ceilometer meter-list +------------+-------+-------+------------------------+---------+----------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +------------+-------+-------+------------------------+---------+----------------------+ | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None | 98ea1b896d3a48438... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None | 98ea1b896d3a48438... | +------------+-------+-------+------------------------+---------+----------------------+root@dlp ~(keystone)# cinder create --display_name disk01 10 root@dlp ~(keystone)# ceilometer meter-list +---------------------+-------+--------+------------------------+---------------------+--------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------+-------+--------+------------------------+---------------------+--------------------+ | image | gauge | image | 2aab2d1a-e1e8-45c9-... | None | 98ea1b896d3a484... | | image.size | gauge | B | 2aab2d1a-e1e8-45c9-... | None | 98ea1b896d3a484... | | volume | gauge | volume | 1dadb51f-9acb-4845-... | 704a7f5cf84a4797... | 98ea1b896d3a484... | | volume.create.end | delta | volume | 1dadb51f-9acb-4845-... | 704a7f5cf84a4797... | 98ea1b896d3a484... | | volume.create.start | delta | volume | 1dadb51f-9acb-4845-... | 704a7f5cf84a4797... | 98ea1b896d3a484... | | volume.size | gauge | GB | 1dadb51f-9acb-4845-... | 704a7f5cf84a4797... | 98ea1b896d3a484... | +---------------------+-------+--------+------------------------+---------------------+--------------------+ |